//
//  UIImage+ZQRender.m
//  BuDeJie
//
//  Created by 仲琦 on 16/4/2.
//  Copyright © 2016年 仲琦. All rights reserved.
//

#import "UIImage+ZQRender.h"

@implementation UIImage (ZQRender)



+ (UIImage *)imageNameWithOriginal:(NSString *)imageName
{
    //图片加载不渲染
    UIImage *image = [UIImage imageNamed:imageName];
    return [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
}


//设置图片圆角
- (UIImage *)circleImage
{
    //开启图形上下文
    UIGraphicsBeginImageContextWithOptions(self.size, NO, 0);
    
    //描述裁剪路径
    UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, self.size.width, self.size.height)];
    
    //设置为裁剪区域
    [path addClip];
    
    //画图片
    [self drawAtPoint:CGPointZero];
    
    //取出图片
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    
    //关闭图形上下文
    UIGraphicsEndImageContext();
    
    return image;
    
}
@end
